package com.woniu.commentorder.console;

import com.hc.entity.Order;
import com.hc.entity.PayRecord;
import com.hc.entity.User;
import com.woniu.commentorder.service.PayRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.Date;

@RestController
@RequestMapping("payrecord")
public class PayRecordConsole {
    @Autowired
    private PayRecordService payRecordService;
    @PostMapping("/add")
    public  String  add(){
        PayRecord payRecord=new PayRecord();
        User user=new User();
        user.setId(1);
        payRecord.setUser(user);
        Order order=new Order();
        order.setId(1);
        payRecord.setOrder(order);
        payRecord.setFee(new BigDecimal("12.3"));
        payRecord.setDateTime(new Date());
        payRecordService.add(payRecord);
        return "加入的记录id"+payRecord.getId();

    }
}
